from django.http import HttpResponse
from django.shortcuts import render

# Create your views here.
from .models import student


def index(request):
    # students = student()
    # students.name = '顾轩'
    # students.sex =0
    # students.qq = '2113757820'
    # students.age =22
    # students.phone = '19928408054'
    # students.email = '2113757820@qq.com'
    # students.save() #保存



        # student.objects.create(
        #    name='顾轩1',
        #    age=22,
        #    sex=0,
        #    qq='2113757821',
        #    email='2113757821@qq.com',
        #    phone='19928408053',
        #
        # )

    # stu = student(
    #        name='顾轩2',
    #        age=22,
    #        sex=0,
    #        qq='2113757822',
    #        email='2113757822@qq.com',
    #        phone='19928408052',
    # )
    # stu.save()



    data =[]
    for i in range(1,5):
        stu = student(name='西西', age=20, sex=0, qq='12344342@qq.com', phone='13234452343')
        data.append(stu)
    #批量添加数据，传入列表
    student.objects.bulk_create(data)
    return HttpResponse("数据添加成功")
